package com.inspector.app.ui.chat;

import android.os.Bundle;
import android.os.Parcelable;

import androidx.annotation.Nullable;
import androidx.databinding.DataBindingUtil;

import com.bumptech.glide.Glide;
import com.inspector.app.BaseApp;
import com.inspector.app.R;
import com.inspector.app.databinding.ActivityPictureBinding;
import com.inspector.app.ui.base.BaseDJActivity;
import com.inspector.app.ui.chat.entity.DataBean;
import com.inspector.app.ui.widget.SmartTouchLayout;

public class PictureActivity extends BaseDJActivity {
    private ActivityPictureBinding viewDataBinding;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        initStatusBar(false);
        viewDataBinding = DataBindingUtil.setContentView(this, R.layout.activity_picture);
        viewDataBinding.setLifecycleOwner(this);
        Bundle extras = getIntent().getExtras();
        DataBean dataBean = extras.getParcelable("DataBean");
        initView(dataBean);
    }

    private void initView(DataBean dataBean) {
        if (dataBean == null) {
            finish();
            return;
        }
        Glide.with(BaseApp.getInstance())
                .load(dataBean.url)
                .into(viewDataBinding.imgPhoto);
        viewDataBinding.stl.setEndViewLocalSize(dataBean.width, dataBean.height, dataBean.localX, dataBean.localY, SmartTouchLayout.EndViewScaleSide.Width);
        viewDataBinding.stl.setMoveExitEnable(true);
        viewDataBinding.stl.setZoomEnable(false);
    }
}
